#include "MIDICommands.h"
#include <cstdlib>

#define NOTE_OFF			0
#define NOTE_ON				1
#define AFTERTOUCH			2
#define CONTROL_CHANGE		3
#define PROGRAM_CHANGE		4
#define CHANNEL_PRESSURE	5
#define PITCH_WHEEL			6
#define EXTRA_COMMANDS		7

typedef struct MIDICommandHandle
{
	unsigned char command;
	unsigned char channel;
	unsigned long deltaTime;
	
	/*union ARGS
	{
		unsigned char			buff[2];
		NOTE_ARGS				noteArgs;
		AFTERTOUCH_ARGS			aftertouchArgs;
		CONTROL_CHANGE_ARGS		controlChangeArgs;
		PROGRAM_CHANGE_ARGS		programChangeArgs;
		CHANNEL_PRESSURE_ARGS	channelPressureArgs;
		PITCH_WHEEL_ARGS		pitchWheelArgs;
	}ARGS;*/

	unsigned char buff[2];

}MIDICommandHandle;

struct ArrayBuilder
{
	MIDICommandHandle* commHandle;
	ArrayBuilder* next;
};

class MIDIObj
{
	public:
		MIDIObj(unsigned char* buffer, int buffLen);
		int StripChannelNotes(int channelNumber, unsigned long* outBuffer, int outLen);

	private:
		MIDICommandHandle* commandHead;
		int numCommands;
};